WriteMetadataFileName Subroutine

private subroutine WriteMetadataFileName(network, filename)

write metadata section to file TODO: full CRS support

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(in) :: network
character(len=*), intent(in) :: filename

Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: fileunit
integer(kind=short), public :: i

Source Code

SUBROUTINE WriteMetadataFileName &
!
(network, filename)

IMPLICIT NONE

! Arguments with intent(in):
TYPE (ObservationalNetwork), INTENT(IN) :: network
CHARACTER (LEN = *), INTENT(IN) :: filename

!local declarations:
INTEGER (KIND = short) :: fileunit
INTEGER (KIND = short) :: i
!----------------------------end of declarations-------------------------------

fileunit = GetUnit ()

OPEN (UNIT = fileunit, file = filename)

WRITE(fileunit,'(a)') 'description = ', TRIM (network % description)
WRITE(fileunit,'(a)') 'unit = ', TRIM (network % unit)
WRITE(fileunit,'(a)') 'epsg = ', ToString (network % epsg)
WRITE(fileunit,'(a, i8)') 'count = ', network % countObs
WRITE(fileunit,'(a, i10)') 'dt = ', network % timeIncrement
WRITE(fileunit,'(a, f10.3)') 'missing-data = ', network % nodata
WRITE(fileunit,'(a, f10.3)') 'offsetz = ', network % offsetZ

WRITE(fileunit,*) !leave one blank line 
WRITE(fileunit,'(a)') 'metadata'
DO i = 1, network % countObs
	WRITE(fileunit,'(a30," ",a9," ",f12.2," ",f12.2," ",f12.2)') &
	      network % obs (i) % name, &
	      network % obs (i) % id,&
	      network % obs (i) % xyz % easting ,&
	      network % obs (i) % xyz % northing ,&
	      network % obs (i) % xyz % elevation
END DO

CLOSE (fileunit)

RETURN
END SUBROUTINE WriteMetadataFileName